package com.xw.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * @Description: Swagger配置
 * @Author: ASUS
 * @Date: 2024/12/19 09:15
 * @Version: 1.0
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket createRestApi() {
        ApiInfo apiInfoBuilder = new ApiInfoBuilder()
                .title("IT培优综合服务平台") // 网站的标题
                .description("IT培优综合服务平台") // 描述
                .version("1.0") // 版本
                .contact(new Contact("xx","","3303786045@qq.com")) // 联系人
                .license("The Apache License") // 协议
                .licenseUrl("") // 协议的URL
                .build();
        return new Docket(DocumentationType.SWAGGER_2) // swagger版本
                .pathMapping("/")
                .select()
                // 扫描controller
                .apis(RequestHandlerSelectors.basePackage("com.xw.controller"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfoBuilder);
    }
}
